<%@page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.util.RequestUtil"%>
<%@page import="com.shsh.safemanage.model.AccidentRegisterForm"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.model.User"%>
<%@page import="com.shsh.safemanage.model.Problem"%>
<%@page import="com.shsh.safemanage.model.Role"%>
<%@page import="com.shsh.safemanage.model.AccidentFacade"%>
<%@page import="com.shsh.safemanage.model.AbstractAccident"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.ProblemDao"%>
<%@page import="com.shsh.safemanage.dao.AccidentDao"%>
<%@page import="com.shsh.safemanage.action.UserAction"%>
<%@page import="com.shsh.safemanage.action.ActionCreator"%>

<%
{
ProblemDao theProblemDao = DaoCreator.createProblemDao();
AccidentDao theAccidentDao = DaoCreator.createAccidentDao();
User theUser = (User) session.getAttribute(Constants.SESSION_USER);

Long problemID = RequestUtil.getParameter(request, Constants.REQUEST_PARAMETER_ID, (Long)null);
if(problemID == null){
	return;
}

Problem theProblem = theProblemDao.getProblemByID(problemID);
AbstractAccident theAccident = null;
if(Constants.PROBLEM_TYPE_ACCIDENT_REGISTERFORM == theProblem.getProblemType()){
	theAccident = theAccidentDao.getRegisterFormByID(problemID);
} else if(Constants.PROBLEM_TYPE_ACCIDENT_INFOSHEET == theProblem.getProblemType()){
	theAccident = theAccidentDao.getInfosheetByID(problemID);
} else if (Constants.PROBLEM_TYPE_ACCIDENT_REPORT == theProblem.getProblemType()){
	theAccident = theAccidentDao.getReportByID(problemID);
} else if (Constants.PROBLEM_TYPE_ACCIDENT_CHECKFORM2 == theProblem.getProblemType()){
	theAccident = theAccidentDao.getCheckFormByID(2, problemID);
} else if (Constants.PROBLEM_TYPE_ACCIDENT_CHECKFORM3 == theProblem.getProblemType()){
	theAccident = theAccidentDao.getCheckFormByID(3, problemID);
} else {
	return;
}


List<AccidentFacade> facadeList = theAccidentDao.searchAccidentByFacadeID(theAccident.getFacadeID());
%>

<div class="hider" id="hider">
	<span>&nbsp;</span>
</div>
<div class="position">
	<img src="images/position2.jpg" style="padding: 7px 9px; float: left;" />当前位置：上海高桥分公司问题管理平台 &gt;&gt; 事故填报
</div>
<div class="tt">《事故申报一览表》</div>
<div class="content">
<table align="center" border="1" width="99%" cellpadding="0" cellspacing="0">
	<tr style="font-weight: bold" align="center">
		<td class="td1" width="10%">作业部（业务中心）</td>
		<td class="td1" width="10%">装置</td>
		<td class="td1" width="6%">事故类型</td>
		<td class="td1" width="15%">事故名称</td>
		<td class="td1" width="8%">事故发生时间</td>
		<td class="td1" width="7%">事故情况登记表</td>
		<td class="td1" width="7%">事故信息单</td>
		<td class="td1" width="7%">事故快报</td>
		<td class="td1" width="7%">事故报表</td>
		<td class="td1" width="7%">事故四不放过检查表（1）</td>
		<td class="td1" width="7%">事故四不放过检查表（2）</td>
		<td class="td1" width="7%">事故四不放过检查表（3）</td>
	</tr>
<%
for (AccidentFacade theFacade : facadeList) {
	request.setAttribute(Constants.REQUEST_ATTRIBUTE_ACCIDENT_FACADE, theFacade);
%>
	<%@include file="/accident/application_row.jsp" %>
<%
}
%>
</table>

</div>
<script type="text/javascript">
function writeAccident(){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/write_registerform.jsp",
			"mainContentDiv", 
			{
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function feedbackRegisterform(problemID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/feedback_registerform.jsp",
			"mainContentDiv", 
			{
				id: problemID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function feedbackInfosheet(problemID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/feedback_infosheet.jsp",
			"mainContentDiv", 
			{
				id: problemID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function writeInfosheet(facadeID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/write_infosheet.jsp",
			"mainContentDiv", 
			{
				facadeID: facadeID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function feedbackQuickreport(problemID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/feedback_infosheet.jsp",
			"mainContentDiv", 
			{
				id: problemID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function writeQuickreport(facadeID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/write_infosheet.jsp",
			"mainContentDiv", 
			{
				facadeID: facadeID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function feedbackReport(problemID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/feedback_report.jsp",
			"mainContentDiv", 
			{
				id: problemID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function writeReport(facadeID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/write_report.jsp",
			"mainContentDiv", 
			{
				facadeID: facadeID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function feedbackCheckform1(problemID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/feedback_report.jsp",
			"mainContentDiv", 
			{
				id: problemID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function writeCheckform1(facadeID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/write_report.jsp",
			"mainContentDiv", 
			{
				facadeID: facadeID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}
function feedbackCheckform2(problemID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/feedback_checkform2.jsp",
			"mainContentDiv", 
			{
				id: problemID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function writeCheckform2(facadeID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/write_checkform2.jsp",
			"mainContentDiv", 
			{
				facadeID: facadeID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}
function feedbackCheckform3(problemID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/feedback_checkform3.jsp",
			"mainContentDiv", 
			{
				id: problemID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}

function writeCheckform3(facadeID){
	loadPageSection(
			"<%=request.getContextPath()%>/accident/write_checkform3.jsp",
			"mainContentDiv", 
			{
				facadeID: facadeID,
				fromPage: '<%=Constants.FROM_PAGE_ACCIDENT_APP_TABLE_PROBLEM%>'
			}, 
			false);
}
</script>
<%
}
%>